package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zr.service.UpdateLineService;
@Controller
@Scope(value="prototype")
public class UpdateLine implements ServletResponseAware{
	private HttpServletResponse resp;
	private int lid1;
	private String lname1;
	private String qd1;
	private String zd1;
	private String way1;
	
	public int getLid1() {
		return lid1;
	}
	public void setLid1(int lid1) {
		this.lid1 = lid1;
	}
	public String getLname1() {
		return lname1;
	}
	public void setLname1(String lname1) {
		this.lname1 = lname1;
	}
	public String getQd1() {
		return qd1;
	}
	public void setQd1(String qd1) {
		this.qd1 = qd1;
	}
	public String getZd1() {
		return zd1;
	}
	public void setZd1(String zd1) {
		this.zd1 = zd1;
	}
	public String getWay1() {
		return way1;
	}
	public void setWay1(String way1) {
		this.way1 = way1;
	}
	@Resource
	private UpdateLineService updateline;
	
	public void updateline(){
		if(way1.length()==0){
			way1=qd1+"—>"+zd1;
		}
		updateline.updateline(lid1, lname1, qd1, zd1, way1);
		try {
			PrintWriter pw = resp.getWriter();
			pw.write("1");
			pw.flush();
			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

	@Override
	public void setServletResponse(HttpServletResponse resp) {
		this.resp=resp;
	}

}
